<template>
    <div>

        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item><i class="el-icon-menu"></i> 实验室管理系统</el-breadcrumb-item>
                <el-breadcrumb-item>卫生检查汇总</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="handle-box">
            <el-input v-model="select_word" placeholder="请输入门牌号" class="handle-input mr10"></el-input>
            <el-button type="primary" icon="search" @click="search">搜索</el-button>
        </div>
        <el-table :data="ruleForm" style="width: 100%">
            <el-table-column type="index" label="序号" width="100"></el-table-column>
            <el-table-column property="doorNumber" label="实验室门牌号"></el-table-column>
            <el-table-column property="hygieneResult" label="卫生状况"></el-table-column>
            <el-table-column property="hygienePerson" label="上报人"></el-table-column>
            <el-table-column property="remark" label="其他备注"></el-table-column>
            <el-table-column property="hygieneTime" label="检查时间"></el-table-column>
        </el-table>
        <el-pagination v-show="page"
                       @size-change="handleSizeChange"
                       @current-change="handleCurrentChange"
                       :current-page.sync="pageNum"
                       :page-size="15"
                       layout="prev, pager, next, jumper"
                       :total="count">
        </el-pagination>
        <el-pagination v-show="!page"
                       @size-change="handleSizeChange1"
                       @current-change="handleCurrentChange1"
                       :current-page.sync="pageNum1"
                       :page-size="15"
                       layout="prev, pager, next, jumper"
                       :total="count1">
        </el-pagination>
    </div>

</template>

<script>
    export default {
        data() {
            return {
                ruleForm: [{
                    doorNumber:'',
                    hygieneResult:'',
                    hygienePerson:'',
                    remark:'',
                    hygieneTime:''
                }],
                currentRow: null,
                select_cate:'',
                select_word:'',
                dialogFormVisible:false,
                formLabelWidth: '120px',
                pageNum: 1,
                pageNum1: 1,
                pageSize:15,
                count:0,
                count1:0,
                page:true,
                allhygiene:true,
                msg:'',
            }
        },
        created(){
            this.getData();
        },

        methods: {
            setCurrent(row) {
                this.$refs.singleTable.setCurrentRow(row);
            },
            handleCurrentChange(val) {
                this.currentRow = val;
            },
            handleEdit(index, row) {
                console.log(index, row);
            },
            handleDelete(index, row) {
                console.log(index, row);
            },
            handleSizeChange(){},

            getData(){
                this.$axios.get('/text/hygiene/query?pageNum=1').then((res)=>{
                    this.ruleForm=res.data.data;
                    if(res.data.code==403){
                        this.$router.push('/login');
                    }
                    else if(res.data.code==302){
                        this.msg=res.data.msg;
                        this.allhygiene=false;
                    }
                    this.count= res.data.data.total;
                    this.ruleForm= res.data.data.list;
                })
            },

            search(select_word){
                this.$axios.get('/text/hygiene/queryfuzzy?pageNum=1'+'&doorNumber='+this.select_word).then((res) => {
                    this.ruleForm= res.data.data.list;
                    this.count1=res.data.data.total;
                })
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            // handleCurrentChange(pageNum,select_word){
            //     this.$axios.get('/text/hygiene/queryfuzzy?pageNume=doorNumber='+pageNum+'&doorNumber='+this.select_word).then((res) => {
            //         this.tableData= res.data.data.list;
            //     })
            // },
            handleCurrentChange(pageNum) {
                this.$axios.get('text/hygiene/query?pageNume='+pageNum).then((res) => {
                    this.ruleForm= res.data.data.list;
                })
            },
            handleCurrentChange1(pageNum1,select_word) {
                this.$axios.get('text/hygiene/queryfuzzy?pageNume='+pageNum1+'&doorNumber'+this.select_word).then((res) => {
                    this.ruleForm= res.data.data.list;
                })
            },


        }
    }
</script>

<style>
    .handle-box{
        margin-bottom: 20px;
    }
    .handle-select{
        width: 120px;
    }
    .handle-input{
        width: 300px;
        display: inline-block;
    }

    .block{
        float: right;
        margin-top: 20px;
    }
</style>
